package utilities;
import people.Person;
import people.SystemAdmin;

/**
 * The Security class; takes care of password encryption 
 * @author Peter
 *
 * @version $Revision: 1.0 $
 */
public class Security {
	
	/**
	 * Constructor that starts up the security class
	 */
	public Security(){

	}
	
	/**
	 * This will encrypt a password and store it in the person/database
	 * @param aPerson
	 * @param pass
	 */
	public void encryptPassword(Person aPerson, String pass){
		aPerson.setUserPass(encryption(pass));
	}
	
	/**
	 * This will check if the password from the input matches the password in the database
	 * @param aPerson
	 * @param inputPass
	 * @return true if it's a match, false otherwise
	 */
	public boolean checkPass(Person aPerson, String inputPass){
		String encrpyted = aPerson.getUserPass();
		inputPass = encryption(inputPass);
		if(encrpyted.equals(inputPass)){
			return true;
		}
		else{
			return false;
		}
	}

	/**
	 * @param aPerson
	 * @param resetPass
	 * @return
	 */
	public String resetPassword(Person aPerson){
		String temp = " ";
		aPerson.setUserPass(" ");
		return temp;
	}

	private String encryption(String aWord){
		//some form of encryption
		return aWord;
	}
}
